<?php ob_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>Quản Lý Người Thuê</title>
  <link href="../jquery/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" />
  <script src="../jquery/jquery-1.9.1.js"></script>
  <script src="../jquery/jquery-ui-1.10.3.custom.min.js"></script>
  <script>
  $(function() {
    $( ".datepicker" ).datepicker({dateFormat:"dd/mm/yy",changeMonth:true,changeYear:true });
  });
		
  </script>
  <link href="style.css" rel="stylesheet" type="text/css" />
  <script src="function.js"></script>
  </head>

  <body>
<?php
  	require_once("function.php");
	session_start();
	if(isset($_SESSION["imgData"]))
	{
		?>
		<script>
            $(document).ready(function(){
                $("img[name=imgHinh]").attr("src",<?php echo "'data:image/jpeg;base64,".base64_encode($_SESSION["imgData"])."'";?>);
            });
        </script>
		<?php
	}
  ?>
<div id="toppage"></div>
<div id="middlepage">
    <div style="float:left;margin:0px 0px 0px 50px"> <span style="float:left">
      <table id="ChiTietNT" border="2">
      <tr>
          <td colspan="2" height="80px" style="font-size:30px" align="center"><strong>Quản Lý Người Thuê</strong></td>
        </tr>
      <tr>
          <td><strong>Họ Tên</strong></td>
          <td><input type="text" name="txtHoTen"/></td>
        </tr>
      <tr>
          <td><strong>Nickname</strong></td>
          <td><input type="text" name="txtNickname"/></td>
        </tr>
      <tr>
          <td><strong>Hình ảnh</strong></td>
          <td><img name="imgHinh" width="100px" height="100px" /> <br/>
          <form id="uploadimage" action="uploadimage.php" method="post" enctype="multipart/form-data">
              <input name="imgFile" type="file" onchange="this.form.submit();"/>
            </form></td>
        </tr>
      <tr>
          <td><strong>Giới Tính</strong></td>
          <td><label>
              <input type="radio" name="RadGioiTinh" value="radNam" id="RadGioiTinh_0" checked="checked" />
              Nam</label>
          <br />
          <label>
              <input type="radio" name="RadGioiTinh" value="radNu" id="RadGioiTinh_1" />
              Nữ</label>
          <br /></td>
        </tr>
      <tr>
          <td><strong>Ngày Sinh</strong></td>
          <td><input type="text" name="dateNgaySinh" class="datepicker" /></td>
        </tr>
      <tr>
          <td><strong>Nơi Sinh</strong></td>
          <td><input type="text" name="txtNoiSinh"/></td>
        </tr>
      <tr>
          <td><strong>Quê Quán</strong></td>
          <td><input type="text" name="txtQueQuan"/></td>
        </tr>
      <tr>
          <td><strong>Dân Tộc</strong></td>
          <td><input type="text" name="txtDanToc"/></td>
        </tr>
      <tr>
          <td><strong>Tôn Giáo</strong></td>
          <td><input type="text" name="txtTonGiao"/></td>
        </tr>
      <tr>
          <td><strong>CMND</strong></td>
          <td><input type="text" name="txtCMND"/></td>
        </tr>
      <tr>
          <td><strong>Nơi Thường Trú</strong></td>
          <td><input type="text" name="txtNoiThuongTru"/></td>
        </tr>
      <tr>
          <td><strong>Nơi Ở Hiện Nay</strong></td>
          <td><input type="text" name="txtNoiOHienNay"/></td>
        </tr>
      <tr>
          <td><strong>Trình Độ</strong></td>
          <td><input type="text" name="txtTrinhDo"/></td>
        </tr>
      <tr>
          <td><strong>Trình Độ Chuyên Môn</strong></td>
          <td><input type="text" name="txtTrinhDoChuyenMon"/></td>
        </tr>
      <tr>
          <td><strong>Tiếng Dân Tộc</strong></td>
          <td><input type="text" name="txtTiengDanToc"/></td>
        </tr>
      <tr>
          <td><strong>Ngoại Ngữ</strong></td>
          <td><input type="text" name="txtNgoaiNgu"/></td>
        </tr>
      <tr>
          <td><strong>Nghề Nghiệp</strong></td>
          <td><input type="text" name="txtNgheNghiep"/></td>
        </tr>
      <tr>
          <td><strong>Từ 14 tuổi</strong></td>
          <td><textarea name="txtTu14t" cols="" rows="5"></textarea></td>
        </tr>
      <tr>
          <td><strong>Đang Thuê</strong></td>
          <td><input name="chkDangThue" type="checkbox" value="" /></td>
        </tr>
      <tr>
          <td><strong>Ngày Vào</strong></td>
          <td><input type="text" name="dateNgayVao" class="datepicker" /></td>
        </tr>
      <tr>
          <td><strong>Ngày Đi</strong></td>
          <td><input type="text" name="dateNgayDi" class="datepicker" /></td>
        </tr>
      <tr>
          <td colspan="2"><input name="btnThem" type="button" value="Thêm" onclick="ThemNT()"/></td>
        </tr>
    </table>
      </span> <span style="float:left;margin:100px 0px 0px 50px">
      <table id="ChiTietTN" border="2">
        <tr>
          <td><strong>Phòng</strong></td>
          <td><select name="cmbPhong">
              <?php LoadDSPhong(); ?>
            </select></td>
        </tr>
        <tr>
          <td colspan="2" height="80px" style="font-size:30px" align="center"><strong>Thân Nhân Người Thuê</strong></td>
        </tr>
        <tr>
          <td><strong>Quan Hệ</strong></td>
          <td><select name="cmbQuanHe">
              <option>Cha</option>
              <option>Mẹ</option>
              <option>Anh Em Trai</option>
              <option>Chị Em Gái</option>
            </select></td>
        </tr>
        <tr>
          <td><strong>Họ Tên</strong></td>
          <td><input type="text" name="txtHoTenTN"/></td>
        </tr>
        <tr>
          <td><strong>Giới Tính</strong></td>
          <td><label>
              <input type="radio" name="RadGioiTinhTN" value="radNam" id="RadGioiTinh_2" checked="checked"/>
              Nam</label>
            <br />
            <label>
              <input type="radio" name="RadGioiTinhTN" value="radNu" id="RadGioiTinh_3" />
              Nữ</label>
            <br /></td>
        </tr>
        <tr>
          <td><strong>Ngày Sinh</strong></td>
          <td><input type="text" name="dateNgaySinhTN" class="datepicker" /></td>
        </tr>
        <tr>
          <td><strong>Nghề Nghiệp</strong></td>
          <td><input type="text" name="txtNgheNghiepTN"/></td>
        </tr>
        <tr>
          <td><strong>Nơi Ở Hiện Nay</strong></td>
          <td><input type="text" name="txtNoiOHienNayTN"/></td>
        </tr>
        <tr>
          <td colspan="2"><input name="btnThemTN" type="button" value="Thêm" onclick="ThemTN()"/></td>
        </tr>
      </table>
      <span style="float:left;margin-top:20px">
      <table id="ThanNhan" border="2">
        <tr style="font-weight:bold">
          <td>Họ Tên</td>
          <td>Giới Tính</td>
          <td>Ngày Sinh</td>
          <td>Quan Hệ</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
      </span> </span> </div>
    <div style="float:left;margin:20px 0px 0px 50px">
    <table id="NguoiThue" border="2">
        <tr style="font-weight:bold">
        <td>STT</td>
        <td></td>
        <td>Họ Tên</td>
        <td>Tên Gọi Khác</td>
        <td>Giới Tính</td>
        <td>Hình</td>
        <td>Ngày Sinh</td>
        <td>Quê Quán</td>
        <td>Dân Tộc</td>
        <td>CMND</td>
        <td>Địa Chỉ Thường Trú</td>
        <td>Đang Thuê</td>
        <td>Phòng</td>
      </tr>
      <?php
	  	$result=mysql_query("select *,DATE_FORMAT(NgaySinh, '%d/%m/%Y')
as NgaySinh,DATE_FORMAT(NgayVao, '%d/%m/%Y')
as NgayVao,DATE_FORMAT(NgayDi, '%d/%m/%Y')
as NgayDi from nguoithue ngth,phong p where ngth.map=p.map order by ngth.MaNT");
		$i=0;
	  	while($row=mysql_fetch_assoc($result))
		{
			$i++;
	  ?>
        <tr id="<?php echo $row["MaNT"] ?>">
        <td><?php echo $i ?></td>
        <td width="50px"><a href="javascript:ChiTietNT(<?php echo $row["MaNT"] ?>)">Chi Tiết</a></td>
        <td class="HoTen"><?php echo $row["HoTen"] ?></td>
        <td class="HoTenKhac"><?php echo $row["HoTenKhac"] ?></td>
        <td class="GioiTinh"><?php echo $row["GioiTinh"] ?></td>
        <td class="Hinh"><?php echo $row["Hinh"] ?></td>
        <td class="NgaySinh"><?php echo $row["NgaySinh"] ?></td>
		<td class="NoiSinh" hidden="true"><?php echo $row["NoiSinh"] ?></td>
        <td class="QueQuan"><?php echo $row["QueQuan"] ?></td>
        <td class="DanToc"><?php echo $row["DanToc"] ?></td>
        <td class="TonGiao" hidden="true"><?php echo $row["TonGiao"] ?></td>
        <td class="CMND"><?php echo $row["CMND"] ?></td>
        <td class="NoiThuongTru"><?php echo $row["NoiThuongTru"] ?></td>
        <td class="NoiOHienNay" hidden="true"><?php echo $row["NoiOHienNay"] ?></td>
        <td class="TrinhDo" hidden="true"><?php echo $row["TrinhDo"] ?></td>
        <td class="TrinhDoChuyenMon" hidden="true"><?php echo $row["TrinhDoChuyenMon"] ?></td>
        <td class="TiengDanToc" hidden="true"><?php echo $row["TiengDanToc"] ?></td>
        <td class="NgoaiNgu" hidden="true"><?php echo $row["NgoaiNgu"] ?></td>
        <td class="NgheNghiep" hidden="true"><?php echo $row["NgheNghiep"] ?></td>
        <td class="Tu14t" hidden="true"><?php echo $row["Tu14t"] ?></td>
        <td class="DangThue"><?php echo $row["DangThue"] ?></td>
        <td class="NgayVao" hidden="true"><?php echo $row["NgayVao"] ?></td>
        <td class="NgayDi" hidden="true"><?php echo $row["NgayDi"] ?></td>
        <td class="TenP"><?php echo $row["TenP"] ?></td>
      </tr>
      <?php
	  	}
	  ?>
      </table>
  </div>
  </div>
<div id="bottompage"> </div>
</body>
</html>